From: Noah Davis Date: Mon, 14 Apr 2025 17:54:25 +0000 (-0400) Subject: [PATCH] tst_scrolling.qml: don't set default angle delta to verticalStepSize, don... X-Git-Tag: archive/raspbian/6.13.0-2+rpi1^2~4 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=eacac0989ada3752a342ac402d8bb51bbbcdab96;p=kf6-kirigami.git [PATCH] tst_scrolling.qml: don't set default angle delta to verticalStepSize, don't test if smooth scrolling is enabled when testing angle delta moves While arbitrary angle deltas are allowed, setting the default angle delta size to verticalStepSize is not semantically correct because verticalStepSize is not an angle delta. We shouldn't make more assumptions about WheelHandler's internal logic than necessary since there is already a way to avoid failing the test when smooth scrolling is enabled. Gbp-Pq: Name upstream_bf7ead57_tst-scrolling-qml-don-t-set-default-angle-delta-to-verticalStepSize-don-t-test-if-smooth-scrolling-is-enabled-when-testing-angle-delta-moves.patch --- diff --git a/autotests/wheelhandler/tst_scrolling.qml b/autotests/wheelhandler/tst_scrolling.qml index 425dcc9..bde3866 100644 --- a/autotests/wheelhandler/tst_scrolling.qml +++ b/autotests/wheelhandler/tst_scrolling.qml @@ -24,36 +24,20 @@ TestCase { width: flickable.implicitWidth height: flickable.implicitHeight - function wheelScrolling(angleDelta = wheelHandler.verticalStepSize) { + function wheelScrolling(angleDelta = 120) { let x = flickable.contentX let y = flickable.contentY const angleDeltaFactor = angleDelta / 120 mouseWheel(flickable, flickable.leftMargin, 0, -angleDelta, -angleDelta, Qt.NoButton) - if (angleDelta === wheelHandler.verticalStepSize) { - tryCompare(flickable, "contentX", Math.round(x + hstep * angleDeltaFactor), Kirigami.Units.longDuration * 2, "+xTick") - } else { - compare(flickable.contentX, Math.round(x + hstep * angleDeltaFactor), "+xTick") - } + tryCompare(flickable, "contentX", Math.round(x + hstep * angleDeltaFactor), Kirigami.Units.longDuration * 2, "+xTick") x = flickable.contentX - if (angleDelta === wheelHandler.verticalStepSize) { - tryCompare(flickable, "contentY", Math.round(y + vstep * angleDeltaFactor), Kirigami.Units.longDuration * 2, "+yTick") - } else { - compare(flickable.contentY, Math.round(y + vstep * angleDeltaFactor), "+yTick") - } + tryCompare(flickable, "contentY", Math.round(y + vstep * angleDeltaFactor), Kirigami.Units.longDuration * 2, "+yTick") y = flickable.contentY mouseWheel(flickable, flickable.leftMargin, 0, angleDelta, angleDelta, Qt.NoButton) - if (angleDelta === wheelHandler.verticalStepSize) { - tryCompare(flickable, "contentX", Math.round(x - hstep * angleDeltaFactor), Kirigami.Units.longDuration * 2, "-xTick") - } else { - compare(flickable.contentX, Math.round(x - hstep * angleDeltaFactor), "-xTick") - } + tryCompare(flickable, "contentX", Math.round(x - hstep * angleDeltaFactor), Kirigami.Units.longDuration * 2, "-xTick") x = flickable.contentX - if (angleDelta === wheelHandler.verticalStepSize) { - tryCompare(flickable, "contentY", Math.round(y - vstep * angleDeltaFactor), Kirigami.Units.longDuration * 2, "-yTick") - } else { - compare(flickable.contentY, Math.round(y - vstep * angleDeltaFactor), "-yTick") - } + tryCompare(flickable, "contentY", Math.round(y - vstep * angleDeltaFactor), Kirigami.Units.longDuration * 2, "-yTick") y = flickable.contentY if (Qt.platform.pluginName !== "xcb") { @@ -69,31 +53,15 @@ TestCase { } mouseWheel(flickable, flickable.leftMargin, 0, -angleDelta, -angleDelta, Qt.NoButton, wheelHandler.pageScrollModifiers) - if (angleDelta === wheelHandler.verticalStepSize) { - tryCompare(flickable, "contentX", Math.round(x + pageWidth * angleDeltaFactor), Kirigami.Units.longDuration * 2, "+xPage") - } else { - compare(flickable.contentX, Math.round(x + pageWidth * angleDeltaFactor), "+xPage") - } + tryCompare(flickable, "contentX", Math.round(x + pageWidth * angleDeltaFactor), Kirigami.Units.longDuration * 2, "+xPage") x = flickable.contentX - if (angleDelta === wheelHandler.verticalStepSize) { - tryCompare(flickable, "contentY", Math.round(y + pageHeight * angleDeltaFactor), Kirigami.Units.longDuration * 2, "+yPage") - } else { - compare(flickable.contentY, Math.round(y + pageHeight * angleDeltaFactor), "+yPage") - } + tryCompare(flickable, "contentY", Math.round(y + pageHeight * angleDeltaFactor), Kirigami.Units.longDuration * 2, "+yPage") y = flickable.contentY mouseWheel(flickable, flickable.leftMargin, 0, angleDelta, angleDelta, Qt.NoButton, wheelHandler.pageScrollModifiers) - if (angleDelta === wheelHandler.verticalStepSize) { - tryCompare(flickable, "contentX", Math.round(x - pageWidth * angleDeltaFactor), Kirigami.Units.longDuration * 2, "-xPage") - } else { - compare(flickable.contentX, Math.round(x - pageWidth * angleDeltaFactor), "-xPage") - } + tryCompare(flickable, "contentX", Math.round(x - pageWidth * angleDeltaFactor), Kirigami.Units.longDuration * 2, "-xPage") x = flickable.contentX - if (angleDelta === wheelHandler.verticalStepSize) { - tryCompare(flickable, "contentY", Math.round(y - pageHeight * angleDeltaFactor), Kirigami.Units.longDuration * 2, "-yPage") - } else { - compare(flickable.contentY, Math.round(y - pageHeight * angleDeltaFactor), "-yPage") - } + tryCompare(flickable, "contentY", Math.round(y - pageHeight * angleDeltaFactor), Kirigami.Units.longDuration * 2, "-yPage") y = flickable.contentY if (Qt.platform.pluginName !== "xcb") {